package com.xcc.myrouter;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.xcc.routerlib.annotation.Autowired;
import com.xcc.routerlib.annotation.RouteNode;

import java.util.ArrayList;
import java.util.List;

/**
 * ****************************************************
 * 作者 :: rookieCi<1056907550@qq.com>
 * ----------------------------------------------------
 * git :: https://gitee.com/rookieci
 * ----------------------------------------------------
 * 博客 :: http://blog.csdn.net/xcccicishuai
 * ----------------------------------------------------
 * 时间 :: 2019/5/28 Add by rookieCi
 * ----------------------------------------------------
 * 描述 :: TwoActivity
 * ****************************************************
 */
@RouteNode
public class TwoActivity extends AppCompatActivity {
    @Autowired
    char c;
    @Autowired
    long id;
    @Autowired
    String name;
    @Autowired(isJsonStr = true)
    List<String> list;
    @Autowired
    MyMode mode;
    private TextView textView;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Intent intent = getIntent();
        id = intent.getLongExtra("id", 0);
        name = intent.getStringExtra("name");
        c = intent.getCharExtra("c", '0');
        mode = intent.getParcelableExtra("mode");
        String json = intent.getStringExtra("list");
        if (!TextUtils.isEmpty(json)) {
            list = new Gson().fromJson(json, new TypeToken<ArrayList<String>>() {
            }.getType());
        }

        textView = findViewById(R.id.text);
        findViewById(R.id.btnGo).setVisibility(View.GONE);

        textView.setText("" + id + name + mode + list);
    }
}
